﻿@model NOSDC.Models.SpecificEvent

@section Title{ @Html.CreatePageTitle("Events") }
@section MetaTags{ }

@if (!Model.NoEvent)
{
    <div id="event">
        <div class="newsPosting">
            <div>
                <div class="leftIcon">
                </div>
                <div class="titleWrapper">
                    <div class="newsTitle">@Model.Event.Title</div>
                    @if (!String.IsNullOrEmpty(Model.Event.Logo))
                    {
                        <div class="newsDate">
                            <img src="@Url.Content("~/Images/Logos/" + @Model.Event.Logo)" alt="@Model.Event.Logo" /></div>
                    }
                </div>
            </div>
            <div class="rightIcon">
            </div>
        </div>
        <div style="padding: 10px;">
            <div class="eventPadding">
                <span class="eventField">About the event</span></div>
            <div class="eventDescription">@Html.Raw(@Model.Event.Description)</div>
            @if (Model.HasSpeakers)
            {
                foreach (var s in Model.Event.Speakers)
                {
                    <div>
                        <div class="eventPadding">
                            <span class="eventField">Speaker</span>: @s.ToString()</div>
                        <div>
                            <span class="eventField">Bio</span>: @s.Bio</div>
                    </div>}
            }
            <br />
            <div class="eventPadding">
                <span class="eventField">Start</span>: @Model.Event.StartDate.ToLongDateString()
                @Model.Event.StartDate.ToLongTimeString() EST</div>
            <div class="eventPadding">
                <span class="eventField">End</span>: @Model.Event.EndDate.ToLongDateString() @Model.Event.EndDate.ToLongTimeString()
                EST</div>
            <div class="eventPadding">
                <span class="eventField">Where</span>: @Model.Event.Location
            </div>
            <div class="eventPadding">
                <span class="eventField">Price</span>: @if(@Model.Event.Price > 0)
                                                       {
                                                           @String.Format("{0:c}", Model.Event.Price);
                                                       } else
                                                       {
                                                           @:<b>Free</b>
                                                       }
            </div>
        </div>
        @if (Model.Event.StartDate > DateTime.Now)
        {
            <div id="eventSignupMain">
                @if (Membership.GetUser() != null)
                {
                    if (Model.IsAttendingEvent)
                    {
                        <div id="attending" style="height: 25px; line-height: 23px;">
                            <img style="vertical-align: middle;" src="../../../Images/information.png" alt="" /><span><strong>You
                                                                                                                          are attending this event!</strong></span></div>
                    }
                    else
                    {
                        <input id="signUp" type="image" src="../../../Images/sign_o.png" alt="SignUp" />
                        @Html.HiddenFor(model => model.EventId)
                    }
                }
                else
                {
                    <strong>You must login to attend this event!</strong>
                }
            </div>
        }
        @if (Model.HasSponsors)
        {
            <br />
            <fieldset id="sponsors" class="expanded eventAttendees" style="clear: both;">
                <div>
                    <div class="commentHeader">
                        Sponsored By</div>
                    <div class="commentTotal">
                        <img id="sponsorButton" src="@Url.Content("~/Images/expand.png")" alt="" /></div>
                </div>
            </fieldset>
            <div id="sponsorList">
                @foreach (var sponsor in Model.Event.Sponsors)
                {
                    <div style="padding: 10px; border-bottom: 1px solid #ddd;">
                        <div style="padding-right: 10px;">
                            <a href="@if (sponsor.Link != null) { @sponsor.Link }"><img src="@Url.Content("~/Images/Sponsors/" + @sponsor.Logo)" alt="@sponsor.Name" /></a></div>
                        <div style="padding-top: 10px;">@sponsor.Description</div>
                    </div>
                }
            </div>
        }
        <br />
        <fieldset id="attendees" class="collapsed eventAttendees" style="clear: both;">
            <div>
                <div class="commentHeader">
                    View Attendees</div>
                <div class="commentTotal">
                    <img id="attendeeButton" src="@Url.Content("~/Images/expand.png")" alt="" /></div>
            </div>
        </fieldset>
        <div class="attendees">
            @for (var i = 0; i < Model.Event.EventAttendees.Count(); i++)
            {
                <div>
                    @if (i % 2 == 0)
                    {
                        <div style="float: left; width: 315px; padding: 5px;">@Membership.GetUser(Model.Event.EventAttendees[i].UserID).UserName</div>
                    }
                    else
                    {
                        <div style="float: right; width: 300px; padding: 5px;">
                            <div style="float: left;">@Membership.GetUser(Model.Event.EventAttendees[i].UserID).UserName</div>
                        </div>}
                </div>
            }
        </div>
    </div>
    <br />
    
}
else
{
    <div class="newsPosting">
        <div>
            <div class="leftIcon">
            </div>
            <div class="titleWrapper">
                <div class="newsTitle">Event not found</div>
            </div>
        </div>
        <div class="rightIcon">
        </div>
    </div>
    <div style="height:270px; vertical-align:middle; text-align:center; margin-top:100px; color:#236B8E; font-weight:bold;font-size:14px;">
        We can not find the event you are looking for.
    </div>
}

@section Right
{
    @{Html.RenderAction("RecentJobs", "Jobs");}
        <br />
    <div class="newsPosting">
        <div>
            <div class="leftIcon"></div>
            <div class="upcomingEvents">
                <div class="newsTitle">
                    Search Events
                </div>
            </div>
        </div>
        <div class="rightIcon"></div>
    </div>

    <div id="eventCalendar" style="padding-top:10px;"></div>
    <br />
    <div style="text-align:center;">@Html.ActionLink("View upcoming event.", "Index", "Events")</div>
    <br />
}

@section JavaScript{
 <script src="@Url.Content("~/Scripts/jquery-ui.min.js")" type="text/javascript"></script>
    <script src="../../Scripts/UpcomingEvents.js" type="text/javascript"></script>
    <script type="text/javascript">
        $("#Events").addClass("selected");
        $("#eventCalendar").datepicker();
        $("#signUp").click(function () {
            eventSignup($("#EventId").val());
        });
    </script>
}

@section CSS{
    <link href="../../Content/themes/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
}